﻿<ValueConversion(GetType(Boolean), GetType(Boolean))>
Public Class BooleanInverterConverter
        Inherits Markup.MarkupExtension
        Implements IValueConverter


        Public Sub New()
        End Sub

    Private Shared mConverter As BooleanInverterConverter
        Public Overrides Function ProvideValue(serviceProvider As IServiceProvider) As Object
            If mConverter Is Nothing Then
            mConverter = New BooleanInverterConverter
            End If
            Return mConverter
        End Function

        Public Function Convert(value As Object, targetType As Type, parameter As Object, culture As Globalization.CultureInfo) As Object Implements IValueConverter.Convert
        If TypeOf value Is Boolean Then
            Return Not CBool(value)
        End If
        Return Nothing
        End Function

        Public Function ConvertBack(value As Object, targetType As Type, parameter As Object, culture As Globalization.CultureInfo) As Object Implements IValueConverter.ConvertBack
        Throw New NotImplementedException
        End Function

End Class
